package JDBC;

import java.sql.SQLException;

public class testcode {
    public static JDBCLearn1 jdbcLearn1 = new JDBCLearn1();
    public static student stu = new student();

    public static void main(String[] args) throws SQLException, ClassNotFoundException {
       find();
    }

    //查询
    public static void find() throws SQLException, ClassNotFoundException {
        JDBCLearn1 jdbcLearn1 = new JDBCLearn1();
        jdbcLearn1.FindAllData();
        jdbcLearn1.close();

    }

    //插入
    public static void insert() throws SQLException, ClassNotFoundException {

        stu.setId(9);
        stu.setName("aa");
        stu.setPassword("123456");
        stu.setNickname("haha");
        jdbcLearn1.insert(stu);
        jdbcLearn1.close();

    }

    //修改
    public static void update() throws SQLException, ClassNotFoundException {

        stu.setId(8);
        stu.setName("HY");
        stu.setPassword("123456");
        stu.setNickname("haha");
        jdbcLearn1.update(stu, 8);
        jdbcLearn1.close();

    }

    //删除
    public static void delete() throws SQLException, ClassNotFoundException {
        jdbcLearn1.Delete(8);
        jdbcLearn1.close();

    }
}
